|
|
|
|
|
|
|
Although it looks a bit long, CreateScript is actually a pretty simple routine. First, it creates a script header, then the database, then all the tables, then the relationships, and finally, it writes a script footer. Simple, right? Now let's get into the subprocesses called from this method. |
|
|
|
|
|
|
|
|
The WrScriptHeader and WrScriptFooter Methods |
|
|
|
|
|
|
|
|
You need to add some code comments at the start and end of all your scripts. Add the WrScriptHeader and WrScriptFooter routines from Listing A.32. |
|
|
|
|
|
|
|
|
Listing A.32. Coding the WrScriptHeader function. |
|
|
|
|
|
|
|
|
Public Function WrScriptHeader(cMDB) As String
'
' write header for text file
'
Dim cTemp As String
'
cTemp = "// " + String(60, "*") + EOL
cTemp = cTemp + "// DATABASE CREATE SCRIPT FOR [" + cMDB + "]" + EOL
cTemp = cTemp + "// " + String(60, "*") + EOL
cTemp = cTemp + "// SQLGEN Version 5.0 - 03/97(MCA)" + EOL
cTemp = cTemp + "// " + EOL
cTemp = cTemp + "// For use with SQL-VB Interpreter" + EOL
cTemp = cTemp + "//" + EOL
cTemp = cTemp + "// CREATED: " + Format(Date, "General Date") + EOL
cTemp = cTemp + "//" + EOL
cTemp = cTemp + "// " + String(60, "*") + EOL
'
WrScriptHeader = cTemp
'
End Function
Public Function WrScriptFooter()
'
' create end of script footer
'
Dim cTemp As String
'
cTemp = "// " + String(60, "*") + EOL
cTemp = cTemp + "// " + "END OF FILE" + EOL
cTemp = cTemp + "// " + String(60, "*") + EOL
'
WrScriptFooter = cTemp
'
End Function |
|
|
|
|
|